#!/usr/bin/python

KIND_SUMMONER = "summoner"
KIND_ILLUSIONIST = "illusionist"
KIND_FORCEFIELDER = "forcefielder"
KIND_SCEPTRE = "sceptre"
KIND_NECROMANCER = "necromancer"
KIND_SOOTHSAYER = "soothsayer"
KIND_SORCERER = "sorcerer"
KIND_SUMMONS = "summons"
KIND_CLONE = "clone"

KINDLIST = (
        KIND_SORCERER,
        KIND_SOOTHSAYER,
        KIND_NECROMANCER,
        KIND_SCEPTRE,
        KIND_FORCEFIELDER,
        KIND_ILLUSIONIST,
        KIND_SUMMONER,
        )

TYPE_NORMAL = "normal"
TYPE_SUMMONS = "summons"
TYPE_CLONE = "clone"
TYPE_CORPSE = "corpse"
TYPE_FIELD = "field"
TYPE_ENCHANTMENT = "enchantment"
TYPE_ENCHANTMENT_AD = "enchantment_ad"
TYPE_FLAG_MOVEMENT = "m"
TYPE_FLAG_ATTACK = "a"
TYPE_FLAG_SELECT = "s"

SKILL_CLONE = "skill_clone"
SKILL_CRUSH_AD = "skill_crush_ad"
SKILL_ENCHANTMENT_AD = "skill_enchantment_ad"
SKILL_SEAL = "skill_seal"
SKILL_EXCHANGE = "skill_exchange"
SKILL_RESURGENCE = "skill_resurgence"
SKILL_RESURGENCE_AD = "skill_resurgence_ad"
SKILL_SUMMON = "skill_summon"
SKILL_SUMMON_AD = "skill_summon_ad"
SKILL_DISMEMBER = "skill_dismember"

SKILLLIST = (
        SKILL_CLONE,
        SKILL_CRUSH_AD,
        SKILL_ENCHANTMENT_AD,
        SKILL_SEAL,
        SKILL_EXCHANGE,
        SKILL_RESURGENCE,
        SKILL_RESURGENCE_AD,
        SKILL_SUMMON,
        SKILL_SUMMON_AD,
        SKILL_DISMEMBER,
        )

ACTION_MOVE = 0
ACTION_CLONE = 1
ACTION_CRUSH_AD = 2
ACTION_ENCHANTMENT_AD = 3
ACTION_EXCHANGE = 4
ACTION_RESURGENCE = 5
ACTION_RESURGENCE_AD = 6
ACTION_SUMMON = 7
ACTION_SUMMON_AD = 8
ACTION_SEAL = 9
ACTION_SELECT_CORPSE = 10

PLAYER1 = "blue"
PLAYER2 = "brown"
PLAYER3 = "green"
PLAYER4 = "yellow"

CHESSSIZE = 65
WINDOW_W = 845
WINDOW_H = 715
BOARD_W = 715
BOARD_H = 715

def board_to_screen(x, y):
    return (x-1) * CHESSSIZE, (y-1) * CHESSSIZE

def screen_to_board(x, y):
    return x // CHESSSIZE + 1, y // CHESSSIZE + 1

def is_center(x, y):
    if x == 6 and y == 6:
        return True
    else:
        return False

def is_inboard(x, y):
    ret = False
    if (x >= 0 and x < 715 and y >= 0 and y < 715):
        ret = True
        if (x < CHESSSIZE and y < CHESSSIZE) or \
                (x < CHESSSIZE and y > 650) or \
                (x > 650 and y < CHESSSIZE) or \
                (x > 650 and y > 650):
            ret = False
    return ret

